/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package fr.cpe.dp.projet2.view;

import java.io.File;
import javax.swing.JFileChooser;
import javax.swing.JOptionPane;

/**
 *
 * @author Benoit
 */
public class Step1MusicPlayerView {
    protected String [] musicBuilderOptions;
    protected String [] musicTypeOptions;

    public Step1MusicPlayerView(String[] musicBuilderOptions,String[] musicTypeOptions) {
        this.musicBuilderOptions = musicBuilderOptions;
        this.musicTypeOptions = musicTypeOptions;
    }
    
    public String chooseMusicType() {
        Integer choice = JOptionPane.showOptionDialog(null, "Quel type de musique voulez-vous lire ?", "Choix du type de musique", 
                JOptionPane.OK_CANCEL_OPTION, JOptionPane.QUESTION_MESSAGE, 
                null, musicTypeOptions, null);
        if(choice == -1) {
            return null;
        }
        return musicTypeOptions[choice];
    }

    public File chooseFile() {
        JFileChooser jFileChooser = new JFileChooser();
        jFileChooser.showOpenDialog(null);
        return jFileChooser.getSelectedFile();
    }

    public String chooseMusicBuilder() {
        Integer choice = JOptionPane.showOptionDialog(null, "Quel type d'algorithme voulez-vous choisir pour la génération de la musique ?", "Choix de l'algorithme de génération de la musique", 
                JOptionPane.OK_CANCEL_OPTION, JOptionPane.QUESTION_MESSAGE, 
                null, musicBuilderOptions, null);
        if(choice == -1) {
            return null;
        }
        return musicBuilderOptions[choice];
    }
}
